home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / util / moni / Scout-src.lha / netinclude / arpa / telnet.h < prev    next >
C/C++ Source or Header  |  2002-09-16  |  8KB  |  282 lines

  1. #ifndef ARPA_TELNET_H
  2. #define    ARPA_TELNET_H \
  3.        "$Id: telnet.h,v 1.1.1.1 2001/11/26 22:21:15 tboeckel Exp $"
  4. /*
  5.  *      Definitions for the TELNET protocol.
  6.  *
  7.  *      Copyright © 1994 AmiTCP/IP Group,
  8.  *                       Network Solutions Development, Inc.
  9.  *                       All rights reserved.
  10.  */
  11.  
  12. #define    IAC    255        /* interpret as command: */
  13. #define    DONT    254        /* you are not to use option */
  14. #define    DO    253        /* please, you use option */
  15. #define    WONT    252        /* I won't use option */
  16. #define    WILL    251        /* I will use option */
  17. #define    SB    250        /* interpret as subnegotiation */
  18. #define    GA    249        /* you may reverse the line */
  19. #define    EL    248        /* erase the current line */
  20. #define    EC    247        /* erase the current character */
  21. #define    AYT    246        /* are you there */
  22. #define    AO    245        /* abort output--but let prog finish */
  23. #define    IP    244        /* interrupt process--permanently */
  24. #define    BREAK    243        /* break */
  25. #define    DM    242        /* data mark--for connect. cleaning */
  26. #define    NOP    241        /* nop */
  27. #define    SE    240        /* end sub negotiation */
  28. #define EOR     239             /* end of record (transparent mode) */
  29. #define    ABORT    238        /* Abort process */
  30. #define    SUSP    237        /* Suspend process */
  31. #define    xEOF    236        /* End of file: EOF is already used... */
  32.  
  33. #define SYNCH    242        /* for telfunc calls */
  34.  
  35. #ifdef TELCMDS
  36. char *telcmds[] = {
  37.     "EOF", "SUSP", "ABORT", "EOR",
  38.     "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
  39.     "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0,
  40. };
  41. #else
  42. extern char *telcmds[];
  43. #endif
  44.  
  45. #define    TELCMD_FIRST    xEOF
  46. #define    TELCMD_LAST    IAC
  47. #define    TELCMD_OK(x)    ((x) <= TELCMD_LAST && (x) >= TELCMD_FIRST)
  48. #define    TELCMD(x)    telcmds[(x)-TELCMD_FIRST]
  49.  
  50. /* telnet options */
  51. #define TELOPT_BINARY    0    /* 8-bit data path */
  52. #define TELOPT_ECHO    1    /* echo */
  53. #define    TELOPT_RCP    2    /* prepare to reconnect */
  54. #define    TELOPT_SGA    3    /* suppress go ahead */
  55. #define    TELOPT_NAMS    4    /* approximate message size */
  56. #define    TELOPT_STATUS    5    /* give status */
  57. #define    TELOPT_TM    6    /* timing mark */
  58. #define    TELOPT_RCTE    7    /* remote controlled transmission and echo */
  59. #define TELOPT_NAOL     8    /* negotiate about output line width */
  60. #define TELOPT_NAOP     9    /* negotiate about output page size */
  61. #define TELOPT_NAOCRD    10    /* negotiate about CR disposition */
  62. #define TELOPT_NAOHTS    11    /* negotiate about horizontal tabstops */
  63. #define TELOPT_NAOHTD    12    /* negotiate about horizontal tab disposition */
  64. #define TELOPT_NAOFFD    13    /* negotiate about formfeed disposition */
  65. #define TELOPT_NAOVTS    14    /* negotiate about vertical tab stops */
  66. #define TELOPT_NAOVTD    15    /* negotiate about vertical tab disposition */
  67. #define TELOPT_NAOLFD    16    /* negotiate about output LF disposition */
  68. #define TELOPT_XASCII    17    /* extended ascic character set */
  69. #define    TELOPT_LOGOUT    18    /* force logout */
  70. #define    TELOPT_BM    19    /* byte macro */
  71. #define    TELOPT_DET    20    /* data entry terminal */
  72. #define    TELOPT_SUPDUP    21    /* supdup protocol */
  73. #define    TELOPT_SUPDUPOUTPUT 22    /* supdup output */
  74. #define    TELOPT_SNDLOC    23    /* send location */
  75. #define    TELOPT_TTYPE    24    /* terminal type */
  76. #define    TELOPT_EOR    25    /* end or record */
  77. #define    TELOPT_TUID    26    /* TACACS user identification */
  78. #define    TELOPT_OUTMRK    27    /* output marking */
  79. #define    TELOPT_TTYLOC    28    /* terminal location number */
  80. #define    TELOPT_3270REGIME 29    /* 3270 regime */
  81. #define    TELOPT_X3PAD    30    /* X.3 PAD */
  82. #define    TELOPT_NAWS    31    /* window size */
  83. #define    TELOPT_TSPEED    32    /* terminal speed */
  84. #define    TELOPT_LFLOW    33    /* remote flow control */
  85. #define TELOPT_LINEMODE    34    /* Linemode option */
  86. #define TELOPT_XDISPLOC    35    /* X Display Location */
  87. #define TELOPT_ENVIRON    36    /* Environment variables */
  88. #define    TELOPT_AUTHENTICATION 37/* Authenticate */
  89. #define    TELOPT_ENCRYPT    38    /* Encryption option */
  90. #define    TELOPT_EXOPL    255    /* extended-options-list */
  91.  
  92.  
  93. #define    NTELOPTS    (1+TELOPT_ENCRYPT)
  94. #ifdef TELOPTS
  95. char *telopts[NTELOPTS+1] = {
  96.     "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
  97.     "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",
  98.     "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS",
  99.     "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO",
  100.     "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT",
  101.     "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD",
  102.     "TACACS UID", "OUTPUT MARKING", "TTYLOC",
  103.     "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
  104.     "LINEMODE", "XDISPLOC", "ENVIRON", "AUTHENTICATION",
  105.     "ENCRYPT",
  106.     0,
  107. };
  108. #endif
  109.  
  110. #define    TELOPT_FIRST    TELOPT_BINARY
  111. #define    TELOPT_LAST    TELOPT_ENCRYPT
  112. #define    TELOPT_OK(x)    ((x) <= TELOPT_LAST && (x) >= TELOPT_FIRST)
  113. #define    TELOPT(x)    telopts[(x)-TELOPT_FIRST]
  114.  
  115. /* sub-option qualifiers */
  116. #define    TELQUAL_IS    0    /* option is... */
  117. #define    TELQUAL_SEND    1    /* send option */
  118. #define    TELQUAL_INFO    2    /* ENVIRON: informational version of IS */
  119. #define    TELQUAL_REPLY    2    /* AUTHENTICATION: client version of IS */
  120. #define    TELQUAL_NAME    3    /* AUTHENTICATION: client version of IS */
  121.  
  122. /*
  123.  * LINEMODE suboptions
  124.  */
  125.  
  126. #define    LM_MODE        1
  127. #define    LM_FORWARDMASK    2
  128. #define    LM_SLC        3
  129.  
  130. #define    MODE_EDIT    0x01
  131. #define    MODE_TRAPSIG    0x02
  132. #define    MODE_ACK    0x04
  133. #define MODE_SOFT_TAB    0x08
  134. #define MODE_LIT_ECHO    0x10
  135.  
  136. #define    MODE_MASK    0x1f
  137.  
  138. /* Not part of protocol, but needed to simplify things... */
  139. #define MODE_FLOW        0x0100
  140. #define MODE_ECHO        0x0200
  141. #define MODE_INBIN        0x0400
  142. #define MODE_OUTBIN        0x0800
  143. #define MODE_FORCE        0x1000
  144.  
  145. #define    SLC_SYNCH    1
  146. #define    SLC_BRK        2
  147. #define    SLC_IP        3
  148. #define    SLC_AO        4
  149. #define    SLC_AYT        5
  150. #define    SLC_EOR        6
  151. #define    SLC_ABORT    7
  152. #define    SLC_EOF        8
  153. #define    SLC_SUSP    9
  154. #define    SLC_EC        10
  155. #define    SLC_EL        11
  156. #define    SLC_EW        12
  157. #define    SLC_RP        13
  158. #define    SLC_LNEXT    14
  159. #define    SLC_XON        15
  160. #define    SLC_XOFF    16
  161. #define    SLC_FORW1    17
  162. #define    SLC_FORW2    18
  163.  
  164. #define    NSLC        18
  165.  
  166. /*
  167.  * For backwards compatability, we define SLC_NAMES to be the
  168.  * list of names if SLC_NAMES is not defined.
  169.  */
  170. #define    SLC_NAMELIST    "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \
  171.             "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \
  172.             "LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0,
  173. #ifdef    SLC_NAMES
  174. char *slc_names[] = {
  175.     SLC_NAMELIST
  176. };
  177. #else
  178. extern char *slc_names[];
  179. #define    SLC_NAMES SLC_NAMELIST
  180. #endif
  181.  
  182. #define    SLC_NAME_OK(x)    ((x) >= 0 && (x) < NSLC)
  183. #define SLC_NAME(x)    slc_names[x]
  184.  
  185. #define    SLC_NOSUPPORT    0
  186. #define    SLC_CANTCHANGE    1
  187. #define    SLC_VARIABLE    2
  188. #define    SLC_DEFAULT    3
  189. #define    SLC_LEVELBITS    0x03
  190.  
  191. #define    SLC_FUNC    0
  192. #define    SLC_FLAGS    1
  193. #define    SLC_VALUE    2
  194.  
  195. #define    SLC_ACK        0x80
  196. #define    SLC_FLUSHIN    0x40
  197. #define    SLC_FLUSHOUT    0x20
  198.  
  199. #define    ENV_VALUE    0
  200. #define    ENV_VAR        1
  201. #define    ENV_ESC        2
  202.  
  203. /*
  204.  * AUTHENTICATION suboptions
  205.  */
  206.  
  207. /*
  208.  * Who is authenticating who ...
  209.  */
  210. #define    AUTH_WHO_CLIENT        0    /* Client authenticating server */
  211. #define    AUTH_WHO_SERVER        1    /* Server authenticating client */
  212. #define    AUTH_WHO_MASK        1
  213.  
  214. /*
  215.  * amount of authentication done
  216.  */
  217. #define    AUTH_HOW_ONE_WAY    0
  218. #define    AUTH_HOW_MUTUAL        2
  219. #define    AUTH_HOW_MASK        2
  220.  
  221. #define    AUTHTYPE_NULL        0
  222. #define    AUTHTYPE_KERBEROS_V4    1
  223. #define    AUTHTYPE_KERBEROS_V5    2
  224. #define    AUTHTYPE_SPX        3
  225. #define    AUTHTYPE_MINK        4
  226. #define    AUTHTYPE_CNT        5
  227.  
  228. #define    AUTHTYPE_TEST        99
  229.  
  230. #ifdef    AUTH_NAMES
  231. char *authtype_names[] = {
  232.     "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0,
  233. };
  234. #else
  235. extern char *authtype_names[];
  236. #endif
  237.  
  238. #define    AUTHTYPE_NAME_OK(x)    ((x) >= 0 && (x) < AUTHTYPE_CNT)
  239. #define    AUTHTYPE_NAME(x)    authtype_names[x]
  240.  
  241. /*
  242.  * ENCRYPTion suboptions
  243.  */
  244. #define    ENCRYPT_IS        0    /* I pick encryption type ... */
  245. #define    ENCRYPT_SUPPORT        1    /* I support encryption types ... */
  246. #define    ENCRYPT_REPLY        2    /* Initial setup response */
  247. #define    ENCRYPT_START        3    /* Am starting to send encrypted */
  248. #define    ENCRYPT_END        4    /* Am ending encrypted */
  249. #define    ENCRYPT_REQSTART    5    /* Request you start encrypting */
  250. #define    ENCRYPT_REQEND        6    /* Request you send encrypting */
  251. #define    ENCRYPT_ENC_KEYID    7
  252. #define    ENCRYPT_DEC_KEYID    8
  253. #define    ENCRYPT_CNT        9
  254.  
  255. #define    ENCTYPE_ANY        0
  256. #define    ENCTYPE_DES_CFB64    1
  257. #define    ENCTYPE_DES_OFB64    2
  258. #define    ENCTYPE_CNT        3
  259.  
  260. #ifdef    ENCRYPT_NAMES
  261. char *encrypt_names[] = {
  262.     "IS", "SUPPORT", "REPLY", "START", "END",
  263.     "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID",
  264.     0,
  265. };
  266. char *enctype_names[] = {
  267.     "ANY", "DES_CFB64",  "DES_OFB64",  0,
  268. };
  269. #else
  270. extern char *encrypt_names[];
  271. extern char *enctype_names[];
  272. #endif
  273.  
  274.  
  275. #define    ENCRYPT_NAME_OK(x)    ((x) >= 0 && (x) < ENCRYPT_CNT)
  276. #define    ENCRYPT_NAME(x)        encrypt_names[x]
  277.  
  278. #define    ENCTYPE_NAME_OK(x)    ((x) >= 0 && (x) < ENCTYPE_CNT)
  279. #define    ENCTYPE_NAME(x)        enctype_names[x]
  280.  
  281. #endif /* !ARPA_TELNET_H */
  282.